// FIO.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "FIO.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

class Node
{
public:
	Node()
		: _id(0), _x(0), _y(0)
	{
	}
	Node(int id, double x, double y)
		: _id(id)
		, _x(x)
		, _y(y)
	{
	}

public:
	int getID() {return _id;};
	double getX() {return _x;};
	double getY() {return _y;};

	void setID(int id) {_id = id;}
	void setX(double x) {_x = x;}
	void setY(double y) {_y = y;}

	void offsetX(double offset) { _x += offset;}
	void offsetY(double offset) { _y += offset;}

private:
	int _id;
	double _x;
	double _y;
};

struct Edge
{
	int id;
	Node* n1;
	Node* n2;
};


// The one and only application object

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	HMODULE hModule = ::GetModuleHandle(NULL);

	if (hModule != NULL)
	{
		// initialize MFC and print and error on failure
		if (!AfxWinInit(hModule, NULL, ::GetCommandLine(), 0))
		{
			// TODO: change error code to suit your needs
			_tprintf(_T("Fatal Error: MFC initialization failed\n"));
			nRetCode = 1;
		}
		else
		{
			const int nNode = 10;

			Node nList[nNode];
			Node nListOffset[nNode];

			for (int i=0;i<nNode;++i)
			{
				nList[i].setID(i+1);
				nList[i].setX(i*10);
				nList[i].setY(0);

				nListOffset[i].setID(i+101);
				nListOffset[i].setX(i*10);
				nListOffset[i].setY(0);
			}

			for (int i=0;i<nNode;++i)
			{
				nListOffset[i].offsetY(10);
			}

			_tprintf(_T("============ Node List ============\n"));
			for (int i=0;i<nNode;++i)
			{
				_tprintf(_T("Node (%d) :[%lf,%lf]\n"), nList[i].getID(), nList[i].getX(), nList[i].getY());
			}
			_tprintf(_T("============ Node List (OFFSET) ============\n"));
			for (int i=0;i<nNode;++i)
			{
				_tprintf(_T("Node (%d) :[%lf,%lf]\n"), nListOffset[i].getID(), nListOffset[i].getX(), nListOffset[i].getY());
			}

			
		}
	}
	else
	{
		// TODO: change error code to suit your needs
		_tprintf(_T("Fatal Error: GetModuleHandle failed\n"));
		nRetCode = 1;
	}

	return nRetCode;
}
